import info.gridworld.actor.Bug;

public class DancingBug extends Bug{
	private int steps;
	private int []turnTimes;
	
	public DancingBug(int []turns) {
		steps = 0;
		turnTimes = turns;
	}
	
	public void DancingTurn(int times) {
		for(int i=1 ; i<times ; i++) {
			turn();
		}
	}
	public void act() {
		if(steps == turnTimes.length){
			steps = 0;
		}
		DancingTurn(turnTimes[steps]);
		steps++;
		if(canMove()) {
			move();
		}
		else{
			turn();
		}
	}
}